/******* CLIENT TCP **************/
#include "connection_socket.h"
/*
#include <gtk/gtk.h>

GtkBuilder* init_file(char *filename);
void ouvrir_fenetre_login();
void ouvrir_fenetre_inscription(GtkWidget* widget, gpointer data);
void ouvrir_fenetre_password_lost(GtkWidget* widget, gpointer data);
void ModeAuto(GtkWidget *widget, gpointer data, GtkWidget * MainWindow);
*/


int main(int argc, char* argv[])
{
	/*gtk_init(&argc, &argv);
	ouvrir_fenetre_login();
	gtk_main();
	*/
	connection_socket* conn = new connection_socket();
	conn->debug_mode = true;
	conn->connect_socket("127.0.0.1");
	requete_socket* requete = new requete_socket();
	requete->type = SOCKET_CONNECT;
	strcpy(requete->login, "arthur");
	strcpy(requete->pass, "");
	strcpy(requete->dest, "");
	conn->send_socket(requete);
	requete_socket* reponse = conn->recv_socket();
	printf("\n Liste des amis : %s \n",reponse->data);
	conn->close_socket();
	return 0;
}
/*
GtkBuilder* init_file(char *filename){
	GError *error = NULL;
	gchar *gfilename = NULL;
	GtkBuilder *builder;
	builder = gtk_builder_new();
	gfilename =  g_build_filename (filename, NULL);
	gtk_builder_add_from_file (builder, gfilename, &error);
      	g_free (gfilename);
	if (error)
	{
		gint code = error->code;
		g_printerr("%s\n", error->message);
		g_error_free (error);
		exit(code);
      	}
	return builder;
}

void ModeAuto(GtkWidget *widget, gpointer data, GtkWidget * MainWindow)
{
    gtk_widget_destroy(MainWindow);
}

void ouvrir_fenetre_inscription(GtkWidget* widget, gpointer data){
	GtkBuilder *builder;
	builder = init_file("login.glade");
	GtkWidget *fenetre_principale = GTK_WIDGET(gtk_builder_get_object (builder, "window_subscribe"));
	g_signal_connect (gtk_builder_get_object (builder, "cancel2"),"clicked", G_CALLBACK(ModeAuto),fenetre_principale);
	gtk_widget_show_all (fenetre_principale);
}

void ouvrir_fenetre_password_lost(GtkWidget* widget, gpointer data){
	GtkBuilder *builder;
	builder = init_file("login.glade");
	GtkWidget *fenetre_principale = GTK_WIDGET(gtk_builder_get_object (builder, "window_subscribe"));
	g_signal_connect (gtk_builder_get_object (builder, "cancel2"),"clicked", G_CALLBACK(ModeAuto),fenetre_principale);
	gtk_widget_show_all (fenetre_principale);
}

void ouvrir_fenetre_login(){
	GtkBuilder *builder;
	builder = init_file("login.glade");
	GtkWidget *fenetre_principale = GTK_WIDGET(gtk_builder_get_object (builder, "window_login"));
	g_signal_connect (G_OBJECT (fenetre_principale), "destroy", (GCallback)gtk_main_quit, NULL);
	g_signal_connect (gtk_builder_get_object (builder, "cancel"),"clicked", (GCallback)gtk_main_quit, NULL);
	g_signal_connect (gtk_builder_get_object (builder, "subscribe"),"clicked", (GCallback)ouvrir_fenetre_inscription, builder);
	g_signal_connect (gtk_builder_get_object (builder, "password_lost"),"clicked", (GCallback)ouvrir_fenetre_password_lost, builder);
	gtk_widget_show_all (fenetre_principale);
}
*/
